<?php
class ProxyFactory
{
	private static $_instance=array();
	private static $_classes=array(
		'default'=>array(
			'IndexProxy'=>'/proxy/IndexProxy.php',
		),
		'auth'=>array(
			'AuthProxy'=>'/proxy/auth/AuthProxy.php',
		),
	);
	
	public static function get($className,$module='default'){
		if(isset(self::$_instance[$module][$className])){
			return self::$_instance[$module][$className];
		}else{
			if(!isset(self::$_classes[$module][$className])) return false;
			include PATH_API.self::$_classes[$module][$className];
			self::$_instance[$module][$className]=new $className();
		}
		return self::$_instance[$module][$className];
	}
	
	/**
	 * 销毁数组
	 */
	public static function reset(){
		self::$_instance=array();
	}
}
